package user

import (
	"fmt"
	"gitee.com/xz_123/toy-web-main/pkg/web/v1"
	v3 "gitee.com/xz_123/toy-web-main/pkg/web3/v3"
)

type Student struct {
	Name string `json:"name"`
	Age  int    `json:"age"`
}

// @Summary 获取单个学生信息
// @Description 获取单个学生信息
// @Tags user
// @Accept json

func User(ctx *v3.Context) {
	stu := new(Student)
	err := ctx.ReadJson(stu)
	if err != nil {
		ctx.SystemErrJson(v1.ComResponse{
			Code: 100001,
			Msg:  fmt.Sprintf("%s", err),
			Data: []string{},
		})
		return
	}
	Resp := v1.ComResponse{
		Code: 200,
		Msg:  "ok",
		Data: stu,
	}
	ctx.OkJson(Resp)
}
